﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AmiEmuLib.AmigaMachine.AmigaCPU
{
    /// <summary>
    /// Methods to work with interrupts.
    /// </summary>
    internal static class Interrupts
    {
        /// <summary>
        /// Compare interrupts priorities.
        /// </summary>
        /// <param name="a_int1"></param>
        /// <param name="a_int2"></param>
        /// <returns></returns>
        public static bool IsPriorityGreaterThan(int a_int1, int a_int2)
        {
            Debug.Assert(a_int1 >= 0);
            Debug.Assert(a_int1 <= 7);
            Debug.Assert(a_int2 >= 0);
            Debug.Assert(a_int2 <= 7);

            return a_int1 > a_int2;
        }

        /// <summary>
        /// Should we fire this interrupt.
        /// </summary>
        /// <param name="a_int"></param>
        /// <param name="a_mask"></param>
        /// <returns></returns>
        public static bool IsInterruptMasked(int a_int, int a_mask)
        {
            Debug.Assert(a_int >= 0);
            Debug.Assert(a_int <= 7);

            if (a_int == 7)
                return false;
            else
                return a_int > a_mask;
        }
    }
}
